package com.ll.domain.user.convert;

import com.ll.domain.classbase.dto.ClassBaseDTO;
import com.ll.domain.user.dto.StudentDTO;
import com.ll.domain.user.enums.RoleEnum;
import com.ll.domain.user.dto.UserDTO;

public class StudentConvert {



    public static StudentDTO userDTO2StudentDTO(UserDTO dto, ClassBaseDTO classBaseDTO) {
        StudentDTO studentDTO = StudentDTO.builder()
                .classIndex(classBaseDTO.getIndexNum())
                .className(classBaseDTO.getName())
                .classStatus(classBaseDTO.getStatus())
                .userName(dto.getUserName())
                .integral(dto.getIntegral())
                .roleDic(dto.getRoleDic())
                .build();
        return studentDTO;
    }

    public static StudentDTO userName2StudentDTO(String userName, ClassBaseDTO classBaseDTO) {
        StudentDTO studentDTO = StudentDTO.builder()
                .classIndex(classBaseDTO.getIndexNum())
                .className(classBaseDTO.getName())
                .classStatus(classBaseDTO.getStatus())
                .userName(userName)
                .roleDic(RoleEnum.弓箭爱好者.getRoleName())
                .build();
        return studentDTO;
    }
}
